home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Source Code / Libraries / XCMD libraries 960603 / dummyXCMD.cp < prev    next >
Text File  |  1995-12-27  |  1KB  |  54 lines

  1. #include    "doXCMDPlusPlus.h"
  2. #include    "xcmdWind.h"
  3.  
  4. //•••••••
  5. //    Do our business
  6. //•••••••
  7.  
  8. void
  9. doXCMDPlusPlus( XCmdPtr paramPtr )
  10. {
  11.     xcmdWindow    xWind( paramPtr );
  12.  
  13.     xWind.returnNil();    // assume no problems. (perhaps a bad name, it doesn't return,
  14.                         // it just sets the return value to nil.)
  15.     try {
  16.     
  17.         if ( xWind.isWindowEvent() ) {    // with xWindow objects always ask this question first.
  18.             xWind.doWindowEvent();
  19.             }
  20.     
  21.     
  22.         else {                            // otherwise process as a command.
  23.         
  24.             xcmdString param( xWind[0] );
  25.             
  26.             if ( param == "OPEN" ) {
  27.                 Rect        theRect = {10,10,50,90};
  28.                 xcmdString    title( "Useless Window" );
  29.                 CWindowPtr cw = 
  30.                     xWind.createWindow( theRect, title, 0 );
  31.     
  32.                 if ( cw == nil ) throw xcmdString( "Out of Memory, cannot create window." );
  33.                 }
  34.     
  35.             else 
  36.             if ( param == "!" ) {
  37.                 xWind.returnMsg( "My wicked xcmd! ©Paul B. Beeken, Knowledge Software Consulting." );
  38.                 }
  39.     
  40.             else 
  41.             if ( param == "?" ) {
  42.                 xWind.returnMsg( "dummyXCMD Open" );
  43.                 }
  44.     
  45.             else throw xcmdString( "Bad command: " ) & param;
  46.  
  47.             } // else
  48.         
  49.         } // try block
  50.  
  51.         catch ( xcmdString s ) {
  52.             xWind.errorMsg( s );
  53.             }
  54. }